package com.wechat.back.service.impl;

import com.wechat.back.mapper.BgMapper;
import com.wechat.back.pojo.pic.Bg;
import com.wechat.back.service.BgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class BgServiceImpl implements BgService {
    @Autowired
    private BgMapper bgMapper;
    @Override
    public List<Bg> list(String bgType) {
        return bgMapper.list(bgType);
    }

    @Override
    public void add(Bg bg) {
        bg.setCreateTime(LocalDateTime.now());
        bg.setUpdateTime(LocalDateTime.now());
        bgMapper.add(bg);
    }

    @Override
    public void update(Bg bg) {
        bg.setUpdateTime(LocalDateTime.now());
        bgMapper.update(bg);
    }

    @Override
    public void delete(Integer bgId) {
        bgMapper.delete(bgId);
    }
}
